import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import math
import random
import os
import time
from PSO import PSO
from SSA import SSA
from SSA2020 import SSA2020
from SCA import SCA
from AOA import AOA
from SAOA import SAOA
from MSAOA import MSAOA
from AOA1 import AOA1
from WOA import WOA
from GSA import GSA
from TLBO import TLBO
import obj_funs
from chart3d import Chart3D

detail = {
    'F1':[-100,100,2],
    'F2':[-10,10,0.2],
    'F3':[-100,100,2],
    'F4':[-100,100,2],
    'F5':[-30,30,0.5],
    'F6':[-100,100,2],
    'F7':[-1.28,1.28,0.02],
    'F8':[-500,500,10],   #多峰开始
    'F9':[-5.12,5.12,0.2],
    'F10':[-30,30,0.5],
    'F11':[-600,600,5],
    'F12':[-50,50,1],
    'F13':[-50,50,1],
    'F14':[-65,65,2],  #2维
    'F15':[-5,5,0.2],  #4维
    'F16':[-5,5,0.2],  #2维
    'F17':[-5,5,0.2],  #2维
    'F18':[-2,2,0.1],  #2维
    'F19':[1,3,0.1],   #3维
    'F20':[0,1,0.05],  #6维
    'F21':[0,10,0.5],  #4维
    'F22':[0,10,0.5],  #4维
    'F23':[0,10,0.5]   #4维
}

if __name__ == '__main__':

    dimensions = 2
    populationSize = 20
    iterations = 100
    fun='F1'
    iter = [5,30,100]#需要展示的迭代中间的描点
    low = [detail[fun][0] for i in range(dimensions)]
    up = [detail[fun][1] for i in range(dimensions)]
    ax = Chart3D(detail[fun][0],detail[fun][1],detail[fun][2],iter=iter,func=getattr(obj_funs, fun))
    # pso = PSO(dimensions, populationSize, iterations, low, up,obj_func=getattr(obj_funs, fun),ax=ax)
    # pso.pso()
    # sca = SCA(dimensions, populationSize, iterations, low, up, obj_func=getattr(obj_funs, fun), ax=ax)
    # sca.sca()
    # ssa = SSA(dimensions, populationSize, iterations, low, up, obj_func=getattr(obj_funs, fun), ax=ax)
    # ssa.ssa()
    # ssa2020 = SSA2020(dimensions, populationSize, iterations, low, up, obj_func=getattr(obj_funs, fun), ax=ax)
    # ssa2020.Tent_SSA()
    # aoa = AOA(dimensions, populationSize, iterations, low, up, obj_func=getattr(obj_funs, fun), ax=ax)
    # aoa.aoa()
    saoa = SAOA(dimensions, populationSize, iterations, low, up, obj_func=getattr(obj_funs, fun), ax=ax)
    saoa.aoa()


